package com.corona.game;

import com.badlogic.gdx.math.Vector2;
import com.corona.Game;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;

/* loaded from: pokewilds.jar:com/pkmngen/game/GenForest2.class */
public class GenForest2 extends Action {
    Vector2 topLeft;
    Vector2 bottomRight;
    public static HashMap<String, String> mates = new HashMap<>();
    public static HashMap<String, String> mates2 = new HashMap<>();
    public Action.Layer layer = Action.Layer.map_120;
    Random rand = new Random();
    HashMap<Vector2, Tile> tilesToAdd = new HashMap<>();
    ArrayList<Vector2> freePositions = new ArrayList<>();
    ArrayList<Action> doActions = new ArrayList<>();

    public static void FlipFormat(String[][] format) {
        int i = 0;
        for (String[] sub : format) {
            int j = 0;
            for (String str : sub) {
                if (i >= 5 - j) {
                    break;
                }
                String temp = format[i][j];
                format[i][j] = format[5 - j][5 - i];
                format[5 - j][5 - i] = temp;
                j++;
            }
            i++;
        }
    }

    public static ArrayList<Tile> GenTiles(String[][] format, int offSetX, int offSetY, Random rand) {
        return GenTiles(format, offSetX, offSetY, rand, false);
    }

    public static ArrayList<Tile> GenTiles(String[][] format, int offSetX, int offSetY, Random rand, boolean color) {
        ArrayList<Tile> tiles = new ArrayList<>();
        String[] emptyOrSolid = {"solid", ""};
        int i = 5;
        for (String[] sub : format) {
            int j = 0;
            int length = sub.length;
            for (int i2 = 0; i2 < length; i2++) {
                String tileName = sub[i2];
                if (tileName == "either") {
                    tileName = emptyOrSolid[rand.nextInt(emptyOrSolid.length)];
                }
                if (tileName != "") {
                    tiles.add(new Tile(tileName, new Vector2((float) (0 + (j * 16) + offSetX), (float) (0 + (i * 16) + offSetY)), color));
                }
                j++;
            }
            i--;
        }
        return tiles;
    }

    public static ArrayList<Tile> getTileSquare(MazeNode node, Vector2 startLoc, Random rand) {
        return getTileSquare(node, startLoc, rand, false);
    }

    public static ArrayList<Tile> getTileSquare(MazeNode node, Vector2 startLoc, Random rand, boolean color) {
        int offSetx = (node.size * node.x) + ((int) startLoc.x);
        int offSetY = (node.size * node.y) + ((int) startLoc.y);
        ArrayList<ArrayList<Tile>> squares = new ArrayList<>();
        new ArrayList();
        String[][] strArr = new String[0];
        String[] ledge = new String[6];
        ledge[0] = "ledge_grass_down";
        ledge[1] = "ledge_grass_down";
        ledge[2] = "ledge_grass_down";
        ledge[3] = "ledge_grass_down";
        ledge[4] = "ledge_grass_down";
        ledge[5] = "ledge_grass_down";
        ledge[rand.nextInt(ledge.length)] = "ledge_grass_ramp";
        if (Arrays.equals(node.isOpen, new boolean[]{false, false})) {
            squares.add(GenTiles(new String[][]{new String[]{"solid", "solid", "", "", "either", "either"}, new String[]{"solid", "solid", "solid", "", "", "either"}, new String[]{"solid", "solid", "solid", "solid", "", ""}, new String[]{"solid", "solid", "solid", "solid", "solid", ""}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}}, offSetx, offSetY, rand, color));
            squares.add(GenTiles(new String[][]{new String[]{"solid", "solid", "", "", "solid", "solid"}, new String[]{"solid", "solid", "", "", "solid", "solid"}, new String[]{"solid", "solid", "either", "", "", ""}, new String[]{"solid", "solid", "either", "either", "", ""}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}}, offSetx, offSetY, rand, color));
        } else if (node.leftOpen ^ node.downOpen) {
            String[][] format = {new String[]{"either", "either", "", "", "either", "either"}, new String[]{"", "", "", "", "", ""}, new String[]{"", "", "", "", "", ""}, new String[]{"", "either", "", "either", "", ""}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}};
            if (node.downOpen) {
                FlipFormat(format);
                if (rand.nextInt(3) == 1) {
                    int randRowIndex = rand.nextInt(format.length - 2) + 1;
                    String[] randRow = format[randRowIndex];
                    boolean onGround = false;
                    ArrayList<Integer> ledgesGoHere = new ArrayList<>();
                    for (int i = 0; i < randRow.length; i++) {
                        if (randRow[i] != "solid") {
                            onGround = true;
                            ledgesGoHere.add(Integer.valueOf(i));
                        } else if (onGround) {
                            break;
                        }
                    }
                    int randIndexForRamp = ledgesGoHere.get(rand.nextInt(ledgesGoHere.size())).intValue();
                    Iterator<Integer> it = ledgesGoHere.iterator();
                    while (it.hasNext()) {
                        Integer index = it.next();
                        randRow[index.intValue()] = "ledge_grass_down";
                        if (index.intValue() == randIndexForRamp) {
                            randRow[index.intValue()] = "ledge_grass_ramp";
                            format[randRowIndex - 1][index.intValue()] = "";
                            format[randRowIndex + 1][index.intValue()] = "";
                        }
                    }
                }
            }
            squares.add(GenTiles(format, offSetx, offSetY, rand, color));
            String[][] format2 = {new String[]{"", "", "", "", "solid", "solid"}, new String[]{"", "", "", "solid", "solid", "solid"}, new String[]{"", "", "", "", "", ""}, new String[]{"", "", "", "", "", ""}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}, new String[]{"solid", "solid", "solid", "solid", "solid", "solid"}};
            if (node.downOpen) {
                FlipFormat(format2);
                if (rand.nextInt(3) == 1) {
                    String[] randRow2 = format2[rand.nextInt(format2.length - 2) + 1];
                    boolean onGround2 = false;
                    ArrayList<Integer> ledgesGoHere2 = new ArrayList<>();
                    for (int i2 = 0; i2 < randRow2.length; i2++) {
                        if (randRow2[i2] != "solid") {
                            onGround2 = true;
                            ledgesGoHere2.add(Integer.valueOf(i2));
                        } else if (onGround2) {
                            break;
                        }
                    }
                    int randIndexForRamp2 = ledgesGoHere2.get(rand.nextInt(ledgesGoHere2.size())).intValue();
                    Iterator<Integer> it2 = ledgesGoHere2.iterator();
                    while (it2.hasNext()) {
                        Integer index2 = it2.next();
                        randRow2[index2.intValue()] = "ledge_grass_down";
                        if (index2.intValue() == randIndexForRamp2) {
                            randRow2[index2.intValue()] = "ledge_grass_ramp";
                        }
                    }
                }
            }
            squares.add(GenTiles(format2, offSetx, offSetY, rand, color));
        } else {
            squares.add(GenTiles(new String[][]{new String[]{"", "", "", "", "solid", "solid"}, new String[]{"", "", "", "either", "solid", "solid"}, new String[]{"", "", "", "", "either", ""}, new String[]{"", "either", "", "", "", ""}, new String[]{"solid", "solid", "either", "", "", ""}, new String[]{"solid", "solid", "", "", "", ""}}, offSetx, offSetY, rand, color));
            squares.add(GenTiles(new String[][]{new String[]{"", "", "", "", "", ""}, new String[]{"", "", "", "", "", ""}, new String[]{"", "", "", "", "", ""}, new String[]{"", "", "", "", "", ""}, new String[]{"solid", "solid", "", "", "", ""}, new String[]{"solid", "solid", "", "", "", ""}}, offSetx, offSetY, rand, color));
        }
        return squares.get(rand.nextInt(squares.size()));
    }

    public static ArrayList<Tile> getTileSquarePlatform1(MazeNode node, Vector2 startLoc, Random rand) {
        int offSetx = (node.size * node.x) + ((int) startLoc.x);
        int offSetY = (node.size * node.y) + ((int) startLoc.y);
        ArrayList<ArrayList<Tile>> squares = new ArrayList<>();
        new ArrayList();
        String[][] strArr = new String[0];
        String[] temp = {"bush1", "tree_small1"};
        String[] rs = {temp[rand.nextInt(temp.length)], "ground1", "ground1"};
        if (node.leftOpen || node.downOpen) {
            if (!node.leftOpen || node.downOpen) {
                if (node.leftOpen || !node.downOpen) {
                    if (node.rampLoc == "down") {
                        squares.add(GenTiles(new String[][]{new String[]{"", "", "ledge_grass_left", "", "", "ledge_grass_right"}, new String[]{"", "", "ledge1_corner_bl", "ledge_grass_ramp", "ledge_grass_down", "ledge1_corner_br"}, new String[]{"", "", "", "", rs[rand.nextInt(rs.length)], ""}, new String[]{"", rs[rand.nextInt(rs.length)], "", "", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", rs[rand.nextInt(rs.length)], "", "", ""}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "", ""}}, offSetx, offSetY, rand));
                    } else if (node.rampLoc == "up") {
                        squares.add(GenTiles(new String[][]{new String[]{"", "", "", "", "", ""}, new String[]{"", "ledge2_corner_tl", "ledge_grass_safari_up", "ledge_grass_safari_up", "ledge_grass_safari_up", "ledge2_corner_tr"}, new String[]{"", "ledge_grass_left", "", "", "", "ledge_grass_right"}, new String[]{"", "ledge1_corner_bl", "ledge_grass_ramp", "ledge_grass_inside_tr", "", "ledge_grass_right"}, new String[]{"", "", "", "ledge_grass_left", "", "ledge_grass_right"}, new String[]{"", "", "ledge2_corner_tl", "ledge_grass_safari_up", "", "ledge_grass_right"}}, offSetx, offSetY, rand));
                    } else if (node.rampLoc == "left") {
                        String[][] format = {new String[]{"", "", "ledge_grass_left", "", "", ""}, new String[]{"", "", "ledge_grass_left", "", "", ""}, new String[]{"", "", "ledge1_corner_br", "ledge_grass_ramp", "ledge_grass_inside_tr", ""}, new String[]{"", "", "", "", "ledge_grass_left", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "", "ledge_grass_left", ""}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "ledge1_corner_br", "ledge_grass_down"}};
                        if (node.downOpen) {
                            FlipFormat(format);
                        }
                        squares.add(GenTiles(format, offSetx, offSetY, rand));
                    } else {
                        String[][] format2 = {new String[]{"", "", "", "ledge_grass_right", "", ""}, new String[]{"", "", "", "ledge_grass_right", "", ""}, new String[]{"", "ledge_grass_inside_tl", "ledge_grass_ramp", "ledge1_corner_br", "", ""}, new String[]{"", "ledge_grass_right", "", "", "", ""}, new String[]{"", "ledge_grass_right", "", "", "tree_large1_noSprite", "tree_large1_noSprite"}, new String[]{"ledge_grass_down", "ledge1_corner_br", "", "", "tree_large1", "tree_large1_noSprite"}};
                        if (node.downOpen) {
                            FlipFormat(format2);
                        }
                        squares.add(GenTiles(format2, offSetx, offSetY, rand));
                    }
                } else if (node.rampLoc == "down") {
                    squares.add(GenTiles(new String[][]{new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "ledge_grass_left", "", "", "ledge_grass_right"}, new String[]{"tree_large1", "tree_large1_noSprite", "ledge_grass_left", "", "", "ledge_grass_right"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "ledge1_corner_bl", "ledge_grass_ramp", "ledge_grass_down", "ledge1_corner_br"}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "", "", ""}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "", ""}}, offSetx, offSetY, rand));
                } else if (node.rampLoc == "left") {
                    squares.add(GenTiles(new String[][]{new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "ledge2_corner_tl", "ledge_grass_safari_up", "ledge_grass_safari_up"}, new String[]{"tree_large1", "tree_large1_noSprite", "", "ledge_grass_left", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "ledge1_corner_bl", "ledge_grass_ramp", "ledge_grass_inside_tr"}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "", "ledge1_corner_bl"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "", "", ""}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "", ""}}, offSetx, offSetY, rand));
                } else {
                    squares.add(GenTiles(new String[][]{new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "", "", ""}, new String[]{"tree_large1", "tree_large1_noSprite", "ledge_grass_safari_up", "ledge_grass_safari_up", "ledge_grass_safari_up", "ledge2_corner_tr"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "", "", "ledge_grass_right"}, new String[]{"tree_large1", "tree_large1_noSprite", "", "ledge_grass_inside_tl", "ledge_grass_ramp", "ledge1_corner_br"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "ledge_grass_right", "", ""}, new String[]{"tree_large1", "tree_large1_noSprite", "", "ledge_grass_safari_up", "ledge_grass_safari_up", "ledge2_corner_tr"}}, offSetx, offSetY, rand));
                }
            } else if (node.rampLoc == "down") {
                squares.add(GenTiles(new String[][]{new String[]{rs[rand.nextInt(rs.length)], rs[rand.nextInt(rs.length)], rs[rand.nextInt(rs.length)], rs[rand.nextInt(rs.length)], rs[rand.nextInt(rs.length)], rs[rand.nextInt(rs.length)]}, new String[]{"ledge_grass_left", "", "", "", "", "ledge_grass_right"}, new String[]{"ledge1_corner_bl", "ledge_grass_down", "ledge_grass_down", "ledge_grass_ramp", "ledge_grass_down", "ledge1_corner_br"}, new String[]{"", "", "", "", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite"}, new String[]{"tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite"}}, offSetx, offSetY, rand));
            } else if (node.rampLoc == "left") {
                squares.add(GenTiles(new String[][]{new String[]{"", "", "", "ledge2_corner_tl", "ledge_grass_safari_up", "ledge_grass_safari_up"}, new String[]{"", "", "", "ledge_grass_left", "", ""}, new String[]{"", "", "", "ledge1_corner_bl", "ledge_grass_ramp", "ledge_grass_inside_tr"}, new String[]{"", "", "", "", "", "ledge1_corner_bl"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite"}, new String[]{"tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite"}}, offSetx, offSetY, rand));
            } else {
                squares.add(GenTiles(new String[][]{new String[]{"ledge_grass_safari_up", "ledge_grass_safari_up", "ledge_grass_safari_up", "ledge2_corner_tr", "", ""}, new String[]{"", "", "", "ledge_grass_right", "", ""}, new String[]{"", "ledge_grass_inside_tl", "ledge_grass_ramp", "ledge1_corner_br", "", ""}, new String[]{"ledge_grass_down", "ledge1_corner_br", "", "", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite"}, new String[]{"tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite"}}, offSetx, offSetY, rand));
            }
        } else if (node.rampLoc == "down") {
            squares.add(GenTiles(new String[][]{new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "ledge_grass_left", "", "", "ledge_grass_right"}, new String[]{"tree_large1", "tree_large1_noSprite", "ledge_grass_left", "", "", "ledge_grass_right"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "ledge_grass_left", "ledge_grass_inside_tl", "ledge_grass_ramp", "ledge1_corner_br"}, new String[]{"tree_large1", "tree_large1_noSprite", "ledge1_corner_bl", "ledge1_corner_br", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite"}, new String[]{"tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite"}}, offSetx, offSetY, rand));
        } else {
            squares.add(GenTiles(new String[][]{new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "ledge2_corner_tl", "ledge_grass_safari_up", "ledge_grass_safari_up"}, new String[]{"tree_large1", "tree_large1_noSprite", "", "ledge_grass_left", "", ""}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "", "ledge1_corner_bl", "ledge_grass_ramp", "ledge_grass_inside_tr"}, new String[]{"tree_large1", "tree_large1_noSprite", "", "", "", "ledge1_corner_bl"}, new String[]{"tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite", "tree_large1_noSprite"}, new String[]{"tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite", "tree_large1", "tree_large1_noSprite"}}, offSetx, offSetY, rand));
        }
        return squares.get(rand.nextInt(squares.size()));
    }

    /* JADX DEBUG: Multi-variable search result rejected for r2v7, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r2v8, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v39, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v62, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v63, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v65, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v67, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v82, resolved type: boolean[] */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v17, types: [boolean[][][][], boolean[][]] */
    /* JADX WARNING: Unknown variable types count: 1 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static boolean[][] Maze_Algo2(int r7, int r8, float r9, float r10, Random r11) {
        /*
        // Method dump skipped, instructions count: 513
        */
        throw new UnsupportedOperationException("Method not decompiled: com.corona.game.GenForest2.Maze_Algo2(int, int, float, float, java.util.Random):boolean[][]");
    }

    /* JADX DEBUG: Multi-variable search result rejected for r2v2, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r2v3, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v37, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v64, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v65, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v67, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v69, resolved type: boolean[] */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v10, types: [boolean[][][][], boolean[][]] */
    /* JADX WARNING: Unknown variable types count: 1 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static boolean[][] Maze_Algo3(int r7, int r8, float r9, float r10, Random r11, ArrayList<Vector2> r12) {
        /*
        // Method dump skipped, instructions count: 544
        */
        throw new UnsupportedOperationException("Method not decompiled: com.corona.game.GenForest2.Maze_Algo3(int, int, float, float, java.util.Random, java.util.ArrayList):boolean[][]");
    }

    /* JADX DEBUG: Multi-variable search result rejected for r0v17, resolved type: boolean[][][][] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v34, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v35, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v38, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v39, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r2v17, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r2v18, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v58, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v81, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v82, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v84, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v86, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v101, resolved type: boolean[] */
    /* JADX WARN: Multi-variable type inference failed */
    public static HashMap<Vector2, MazeNode> Maze_Algo1(int width, int height, float complexity, float density, int squareSize, Random rand) {
        int width2 = ((width / 2) * 2) + 2;
        int height2 = ((height / 2) * 2) + 2;
        float complexity2 = (float) ((int) (complexity * ((float) (5 * (height2 + width2)))));
        float density2 = (float) ((int) (density * ((float) ((height2 / 2) * (width2 / 2)))));
        boolean[][][][] zArr = new boolean[width2][height2][];
        for (int i = 0; i < width2; i++) {
            for (int j = 0; j < height2; j++) {
                if (i == 0 || i == width2 - 2 || j == 0 || j == height2 - 2) {
                    zArr[i][j] = Boolean.TRUE.booleanValue();
                }
            }
        }
        for (int i2 = 0; ((float) i2) < density2; i2++) {
            int x = rand.nextInt(width2 / 2) * 2;
            int y = rand.nextInt(height2 / 2) * 2;
            zArr[x][y] = Boolean.TRUE.booleanValue();
            for (int j2 = 0; ((float) j2) < complexity2; j2++) {
                ArrayList<int[]> neighbours = new ArrayList<>();
                if (x > 1) {
                    neighbours.add(new int[]{x - 2, y});
                }
                if (x < width2 - 2) {
                    neighbours.add(new int[]{x + 2, y});
                }
                if (y > 1) {
                    neighbours.add(new int[]{x, y - 2});
                }
                if (y < height2 - 2) {
                    neighbours.add(new int[]{x, y + 2});
                }
                if (!neighbours.isEmpty()) {
                    int randomNum = rand.nextInt(neighbours.size());
                    int x_ = neighbours.get(randomNum)[0];
                    int y_ = neighbours.get(randomNum)[1];
                    if (zArr[x_][y_] == Boolean.FALSE.booleanValue()) {
                        zArr[x_][y_] = Boolean.TRUE.booleanValue();
                        zArr[x_ + ((x - x_) / 2)][y_ + ((y - y_) / 2)] = Boolean.TRUE.booleanValue();
                        x = x_;
                        y = y_;
                    }
                }
            }
        }
        for (int i3 = height2 - 1; i3 >= 0; i3--) {
            for (int j3 = 0; j3 < width2; j3++) {
                System.out.print(String.valueOf(zArr[j3][i3] != 0 ? 1 : 0) + " ");
            }
            System.out.print("\n");
        }
        HashMap<Vector2, MazeNode> nodes = new HashMap<>();
        for (int i4 = 0; i4 < width2 / 2; i4++) {
            for (int j4 = 0; j4 < height2 / 2; j4++) {
                nodes.put(new Vector2((float) i4, (float) j4), new MazeNode(i4, j4, new boolean[]{zArr[i4 * 2][(j4 * 2) + 1] == 0, zArr[(i4 * 2) + 1][j4 * 2] == 0}, squareSize));
            }
        }
        return nodes;
    }

    /* JADX DEBUG: Multi-variable search result rejected for r0v9, resolved type: boolean[][][][] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v26, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v27, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v30, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v31, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r2v12, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r2v13, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v50, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v73, resolved type: java.lang.Object[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v74, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r0v76, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v78, resolved type: boolean[] */
    /* JADX DEBUG: Multi-variable search result rejected for r0v93, resolved type: boolean[] */
    /* JADX WARN: Multi-variable type inference failed */
    public static HashMap<Vector2, MazeNode> Maze_Algo4(int width, int height, float complexity, float density, int squareSize, Random rand) {
        int width2 = ((width / 2) * 2) + 2;
        int height2 = ((height / 2) * 2) + 2;
        boolean[][][][] zArr = new boolean[width2][height2][];
        for (int i = 0; i < width2; i++) {
            for (int j = 0; j < height2; j++) {
                if (i == 0 || i == width2 - 2 || j == 0 || j == height2 - 2) {
                    zArr[i][j] = Boolean.TRUE.booleanValue();
                }
            }
        }
        for (int i2 = 0; ((float) i2) < density; i2++) {
            int x = rand.nextInt(width2 / 2) * 2;
            int y = rand.nextInt(height2 / 2) * 2;
            zArr[x][y] = Boolean.TRUE.booleanValue();
            for (int j2 = 0; ((float) j2) < complexity; j2++) {
                ArrayList<int[]> neighbours = new ArrayList<>();
                if (x > 1) {
                    neighbours.add(new int[]{x - 2, y});
                }
                if (x < width2 - 2) {
                    neighbours.add(new int[]{x + 2, y});
                }
                if (y > 1) {
                    neighbours.add(new int[]{x, y - 2});
                }
                if (y < height2 - 2) {
                    neighbours.add(new int[]{x, y + 2});
                }
                if (!neighbours.isEmpty()) {
                    int randomNum = rand.nextInt(neighbours.size());
                    int x_ = neighbours.get(randomNum)[0];
                    int y_ = neighbours.get(randomNum)[1];
                    if (zArr[x_][y_] == Boolean.FALSE.booleanValue()) {
                        zArr[x_][y_] = Boolean.TRUE.booleanValue();
                        zArr[x_ + ((x - x_) / 2)][y_ + ((y - y_) / 2)] = Boolean.TRUE.booleanValue();
                        x = x_;
                        y = y_;
                    }
                }
            }
        }
        for (int i3 = height2 - 1; i3 >= 0; i3--) {
            for (int j3 = 0; j3 < width2; j3++) {
                System.out.print(String.valueOf(zArr[j3][i3] != 0 ? 1 : 0) + " ");
            }
            System.out.print("\n");
        }
        HashMap<Vector2, MazeNode> nodes = new HashMap<>();
        for (int i4 = 0; i4 < width2 / 2; i4++) {
            for (int j4 = 0; j4 < height2 / 2; j4++) {
                nodes.put(new Vector2((float) i4, (float) j4), new MazeNode(i4, j4, new boolean[]{zArr[i4 * 2][(j4 * 2) + 1] == 0, zArr[(i4 * 2) + 1][j4 * 2] == 0}, squareSize));
            }
        }
        return nodes;
    }

    static {
        mates.put("nidoqueen", "nidoking");
        mates.put("nidoking", "nidoqueen");
        mates.put("charizard", "charizard");
        mates.put("venusaur", "venusaur");
        mates.put("meganium", "meganium");
        mates.put("nidorina", "nidorino");
        mates.put("nidorino", "nidorina");
        mates2.put("tauros", "miltank");
        mates2.put("miltank", "tauros");
    }

    public GenForest2(Game game, Vector2 startLoc, Vector2 endLoc) {
        super(new Object[0]);
        ArrayList<Tile> tileSquare;
        for (MazeNode node : Maze_Algo1(((int) ((endLoc.x - startLoc.x) / ((float) 96))) * 2, ((int) ((endLoc.y - startLoc.y) / ((float) 96))) * 2, 0.1f, 0.9f, 96, this.rand).values()) {
            if (node.type == "platform1") {
                tileSquare = getTileSquarePlatform1(node, startLoc, this.rand);
            } else {
                tileSquare = getTileSquare(node, startLoc, this.rand);
            }
            Iterator<Tile> it = tileSquare.iterator();
            while (it.hasNext()) {
                Tile tile = it.next();
                this.tilesToAdd.put(tile.position.cpy(), tile);
            }
        }
        new ApplyForestBiome(this.tilesToAdd, startLoc, endLoc.cpy(), this).step(game);
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        if (!this.tilesToAdd.isEmpty()) {
            Tile currTile = this.tilesToAdd.values().iterator().next();
            game.map.tiles.put(currTile.position.cpy(), currTile);
            this.tilesToAdd.remove(currTile.position.cpy());
            for (int i = 0; i < 10 && !this.tilesToAdd.isEmpty(); i++) {
                Tile currTile2 = this.tilesToAdd.values().iterator().next();
                game.map.tiles.put(currTile2.position.cpy(), currTile2);
                this.tilesToAdd.remove(currTile2.position.cpy());
            }
        } else if (this.doActions.isEmpty()) {
            game.actionStack.remove(this);
            game.map.tiles.put(new Vector2(0.0f, 64.0f), new MegaGengarTile(new Vector2(0.0f, 64.0f)));
        } else {
            Action currAction = this.doActions.get(0);
            this.doActions.remove(0);
            game.insertAction(currAction);
            game.actionStack.remove(this);
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/GenForest2$AddPlatform.class */
    public class AddPlatform extends Action {
        public Action.Layer layer = Action.Layer.map_120;
        Random rand = new Random();
        ArrayList<Tile> tilesToAdd;
        ArrayList<Vector2> freePositions;
        Vector2 startPosition;
        Action nextAction;
        int numLevels;
        Vector2 bottomLeft;
        Vector2 topRight;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public AddPlatform(Game game, ArrayList<Tile> tilesToAdd, ArrayList<Vector2> freePositions, Vector2 startLoc, Vector2 endLoc, Action nextAction) {
            super(new Object[0]);
            GenForest2.this = this$0;
            this.nextAction = nextAction;
            this.freePositions = freePositions;
            this.tilesToAdd = tilesToAdd;
            int x = this.rand.nextInt((int) (endLoc.x - startLoc.x)) + ((int) startLoc.x);
            int y = this.rand.nextInt((int) (endLoc.y - startLoc.y)) + ((int) startLoc.y);
            int width = (int) (((0.5f * (endLoc.x - startLoc.x)) + (((((float) (this.rand.nextInt(10) + 1)) / 10.0f) * 0.33333334f) * (endLoc.x - startLoc.x))) - (0.16666667f * (endLoc.x - startLoc.x)));
            int height = (int) (((0.5f * (endLoc.y - startLoc.y)) + (((((float) (this.rand.nextInt(10) + 1)) / 10.0f) * 0.33333334f) * (endLoc.y - startLoc.y))) - (0.16666667f * (endLoc.y - startLoc.y)));
            this.bottomLeft = new Vector2((float) (x - (width / 2)), (float) (y - (height / 2)));
            this.topRight = new Vector2((float) (x + (width / 2)), (float) (y + (height / 2)));
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            ArrayList<Vector2> platformGoesHere = new ArrayList<>();
            Iterator<Vector2> it = this.freePositions.iterator();
            while (it.hasNext()) {
                Vector2 pos = it.next();
                if (pos.x >= this.bottomLeft.x && pos.x <= this.topRight.x && pos.y >= this.bottomLeft.y && pos.y <= this.topRight.y) {
                    platformGoesHere.add(pos.cpy());
                }
            }
            if (platformGoesHere.isEmpty()) {
                game.insertAction(this.nextAction);
                game.actionStack.remove(this);
                return;
            }
            ArrayList<Vector2> bottomLedges = new ArrayList<>();
            Iterator<Vector2> it2 = platformGoesHere.iterator();
            while (it2.hasNext()) {
                Vector2 pos2 = it2.next();
                boolean upPlatform = false;
                boolean leftPlatform = false;
                boolean rightPlatform = false;
                boolean downPlatform = false;
                if (platformGoesHere.contains(new Vector2(pos2.x + 16.0f, pos2.y))) {
                    rightPlatform = true;
                }
                if (platformGoesHere.contains(new Vector2(pos2.x - 16.0f, pos2.y))) {
                    leftPlatform = true;
                }
                if (platformGoesHere.contains(new Vector2(pos2.x, pos2.y + 16.0f))) {
                    upPlatform = true;
                }
                if (platformGoesHere.contains(new Vector2(pos2.x, pos2.y - 16.0f))) {
                    downPlatform = true;
                }
                if (rightPlatform && !leftPlatform && upPlatform && downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge_grass_left", new Vector2(pos2.x, pos2.y)));
                } else if (!rightPlatform && leftPlatform && upPlatform && downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge_grass_right", new Vector2(pos2.x, pos2.y)));
                } else if (rightPlatform && leftPlatform && !upPlatform && downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge_grass_safari_up", new Vector2(pos2.x, pos2.y)));
                } else if (rightPlatform && leftPlatform && upPlatform && !downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge_grass_down", new Vector2(pos2.x, pos2.y)));
                    bottomLedges.add(pos2);
                } else if (rightPlatform && !leftPlatform && upPlatform && !downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge1_corner_bl", new Vector2(pos2.x, pos2.y)));
                } else if (!rightPlatform && leftPlatform && upPlatform && !downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge1_corner_br", new Vector2(pos2.x, pos2.y)));
                } else if (rightPlatform && !leftPlatform && !upPlatform && downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge2_corner_tl", new Vector2(pos2.x, pos2.y)));
                } else if (!rightPlatform && leftPlatform && !upPlatform && downPlatform) {
                    this.tilesToAdd.add(new Tile("ledge2_corner_tr", new Vector2(pos2.x, pos2.y)));
                } else if (rightPlatform || leftPlatform || upPlatform || downPlatform) {
                    this.tilesToAdd.add(new Tile("ground1", new Vector2(pos2.x, pos2.y)));
                } else {
                    this.tilesToAdd.add(new Tile("rock1", new Vector2(pos2.x, pos2.y)));
                }
                this.freePositions.remove(pos2);
            }
            if (!bottomLedges.isEmpty()) {
                this.tilesToAdd.add(new Tile("ledge_grass_ramp", bottomLedges.get(this.rand.nextInt(bottomLedges.size())).cpy()));
                if (this.rand.nextInt(2) == 1) {
                    this.tilesToAdd.add(new Tile("ledge_grass_ramp", bottomLedges.get(this.rand.nextInt(bottomLedges.size())).cpy()));
                }
            }
            game.insertAction(this.nextAction);
            game.actionStack.remove(this);
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/GenForest2$ApplyForestBiome.class */
    public static class ApplyForestBiome extends Action {
        public Action.Layer layer;
        Random rand;
        HashMap<Vector2, Tile> tilesToAdd;
        ArrayList<Vector2> freePositions;
        Action nextAction;
        Vector2 bottomLeft;
        Vector2 topRight;
        boolean color;
        Route currRoute;

        public ApplyForestBiome(HashMap<Vector2, Tile> tilesToAdd, Vector2 bottomLeft, Vector2 topRight, Action nextAction) {
            this(tilesToAdd, bottomLeft, topRight, false, nextAction);
        }

        public ApplyForestBiome(HashMap<Vector2, Tile> tilesToAdd, Vector2 bottomLeft, Vector2 topRight, boolean color, Action nextAction) {
            super(new Object[0]);
            this.layer = Action.Layer.map_120;
            this.color = color;
            this.nextAction = nextAction;
            this.rand = new Random();
            this.tilesToAdd = tilesToAdd;
            this.bottomLeft = bottomLeft;
            this.topRight = topRight;
            this.currRoute = new Route("forest1", 22);
        }

        public void addPond() {
            ArrayList<Vector2> keySet = new ArrayList<>(this.tilesToAdd.keySet());
            Vector2 randBLCorner = keySet.get(this.rand.nextInt(keySet.size())).cpy();
            Vector2 randTRCorner = randBLCorner.cpy().add((float) ((this.rand.nextInt(12) * 16) + 32), (float) ((this.rand.nextInt(12) * 16) + 32));
            ArrayList<Vector2> pondGoesHere = new ArrayList<>();
            for (float i = randBLCorner.x; i < randTRCorner.x; i += 16.0f) {
                for (float j = randBLCorner.y; j < randTRCorner.y; j += 16.0f) {
                    int surroundedBy = 0;
                    Tile temp2 = this.tilesToAdd.get(new Vector2(i + 16.0f, j));
                    if (temp2 != null && temp2.name == "solid") {
                        surroundedBy = 0 + 1;
                    }
                    Tile temp22 = this.tilesToAdd.get(new Vector2(i - 16.0f, j));
                    if (temp22 != null && temp22.name == "solid") {
                        surroundedBy++;
                    }
                    Tile temp23 = this.tilesToAdd.get(new Vector2(i, j + 16.0f));
                    if (temp23 != null && temp23.name == "solid") {
                        surroundedBy++;
                    }
                    Tile temp24 = this.tilesToAdd.get(new Vector2(i, j - 16.0f));
                    if (temp24 != null && temp24.name == "solid") {
                        surroundedBy++;
                    }
                    Tile temp = this.tilesToAdd.get(new Vector2(i, j));
                    if (temp != null && surroundedBy > 1 && temp.name == "solid") {
                        pondGoesHere.add(temp.position.cpy());
                    }
                }
            }
            Iterator<Vector2> it = pondGoesHere.iterator();
            while (it.hasNext()) {
                Vector2 pos = it.next();
                boolean upPond = false;
                boolean leftPond = false;
                boolean rightPond = false;
                boolean downPond = false;
                if (pondGoesHere.contains(new Vector2(pos.x + 16.0f, pos.y))) {
                    rightPond = true;
                }
                if (pondGoesHere.contains(new Vector2(pos.x - 16.0f, pos.y))) {
                    leftPond = true;
                }
                if (pondGoesHere.contains(new Vector2(pos.x, pos.y + 16.0f))) {
                    upPond = true;
                }
                if (pondGoesHere.contains(new Vector2(pos.x, pos.y - 16.0f))) {
                    downPond = true;
                }
                if (rightPond && !leftPond && upPond && downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_left", new Vector2(pos.x, pos.y)));
                } else if (!rightPond && leftPond && upPond && downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_right", new Vector2(pos.x, pos.y)));
                } else if (rightPond && leftPond && !upPond && downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_top", new Vector2(pos.x, pos.y)));
                } else if (rightPond && !leftPond && !upPond && downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_tl", new Vector2(pos.x, pos.y)));
                } else if (!rightPond && leftPond && !upPond && downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_tr", new Vector2(pos.x, pos.y)));
                } else if (rightPond && !leftPond && upPond && !downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_left", new Vector2(pos.x, pos.y)));
                } else if (!rightPond && leftPond && upPond && !downPond) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1_ledge1_right", new Vector2(pos.x, pos.y)));
                } else if ((rightPond ? 1 : 0) + (leftPond ? 1 : 0) + (upPond ? 1 : 0) + (downPond ? 1 : 0) > 1) {
                    this.tilesToAdd.put(pos.cpy(), new Tile("water1", new Vector2(pos.x, pos.y)));
                }
            }
        }

        public void fillAllEmptyTiles() {
            String[] randomTile = {"ground3", "ground1", "ground3", "ground1", "ground3", "ground1", "ground3", "ground1", "flower1"};
            for (float i = this.bottomLeft.x; i < this.topRight.x; i += 16.0f) {
                for (float j = this.bottomLeft.y; j < this.topRight.y; j += 16.0f) {
                    Tile temp = this.tilesToAdd.get(new Vector2(i, j));
                    String tileName = randomTile[this.rand.nextInt(randomTile.length)];
                    if (temp == null && tileName != "") {
                        this.tilesToAdd.put(new Vector2(i, j), new Tile(tileName, new Vector2(i, j)));
                    }
                }
            }
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        public void plantGrass() {
            Vector2 startPosition = null;
            int iter = 0;
            while (startPosition == null && iter < 20 && (((int) this.topRight.x) - ((int) this.bottomLeft.x)) - 64 != 0) {
                iter++;
                int randX = Math.abs((((int) this.topRight.x) - ((int) this.bottomLeft.x)) - 64) + ((int) this.bottomLeft.x);
                int randX2 = (this.rand.nextInt(randX <= 0 ? 1 : randX) / 16) * 16;
                int randY = Math.abs((((int) this.topRight.y) - ((int) this.bottomLeft.y)) - 64) + ((int) this.bottomLeft.y);
                Vector2 randomPos = new Vector2((float) randX2, (float) ((this.rand.nextInt(randY <= 0 ? 1 : randY) / 16) * 16));
                if (this.tilesToAdd.get(randomPos.cpy().add(0.0f, 0.0f)) == null && this.tilesToAdd.get(randomPos.cpy().add(16.0f, 0.0f)) == null && this.tilesToAdd.get(randomPos.cpy().add(0.0f, 16.0f)) == null && this.tilesToAdd.get(randomPos.cpy().add(16.0f, 16.0f)) == null) {
                    startPosition = randomPos;
                }
            }
            if (startPosition != null) {
                String name = "grass1";
                if (this.color) {
                    name = "grass2";
                }
                this.tilesToAdd.put(startPosition.cpy(), new Tile(name, startPosition.cpy(), this.color, this.currRoute));
                this.tilesToAdd.put(startPosition.cpy().cpy().add(16.0f, 0.0f), new Tile(name, startPosition.cpy().add(16.0f, 0.0f), this.color, this.currRoute));
                this.tilesToAdd.put(startPosition.cpy().cpy().add(0.0f, 16.0f), new Tile(name, startPosition.cpy().add(0.0f, 16.0f), this.color, this.currRoute));
                this.tilesToAdd.put(startPosition.cpy().cpy().add(16.0f, 16.0f), new Tile(name, startPosition.cpy().add(16.0f, 16.0f), this.color, this.currRoute));
                Vector2 currPos = startPosition.cpy();
                int randomNum = this.rand.nextInt(12 - 2) + 2;
                for (int i = 0; i < randomNum; i++) {
                    ArrayList<Vector2> nextPositions = new ArrayList<>();
                    if (this.tilesToAdd.get(currPos.cpy().add(-16.0f, 0.0f)) == null && this.tilesToAdd.get(currPos.cpy().add(-16.0f, 16.0f)) == null) {
                        nextPositions.add(currPos.cpy().add(-16.0f, 0.0f));
                    }
                    if (this.tilesToAdd.get(currPos.cpy().add(32.0f, 0.0f)) == null && this.tilesToAdd.get(currPos.cpy().add(32.0f, 16.0f)) == null) {
                        nextPositions.add(currPos.cpy().add(16.0f, 0.0f));
                    }
                    if (this.tilesToAdd.get(currPos.cpy().add(0.0f, 32.0f)) == null && this.tilesToAdd.get(currPos.cpy().add(16.0f, 32.0f)) == null) {
                        nextPositions.add(currPos.cpy().add(0.0f, 16.0f));
                    }
                    if (this.tilesToAdd.get(currPos.cpy().add(0.0f, -16.0f)) == null && this.tilesToAdd.get(currPos.cpy().add(16.0f, -16.0f)) == null) {
                        nextPositions.add(currPos.cpy().add(0.0f, -16.0f));
                    }
                    if (!nextPositions.isEmpty()) {
                        Vector2 newPos = nextPositions.get(this.rand.nextInt(nextPositions.size()));
                        this.tilesToAdd.put(newPos.cpy(), new Tile(name, newPos.cpy()));
                        this.tilesToAdd.put(newPos.cpy().add(16.0f, 0.0f), new Tile(name, newPos.cpy().add(16.0f, 0.0f), this.color, this.currRoute));
                        this.tilesToAdd.put(newPos.cpy().add(0.0f, 16.0f), new Tile(name, newPos.cpy().add(0.0f, 16.0f), this.color, this.currRoute));
                        this.tilesToAdd.put(newPos.cpy().add(16.0f, 16.0f), new Tile(name, newPos.cpy().add(16.0f, 16.0f), this.color, this.currRoute));
                        currPos = newPos;
                    } else {
                        return;
                    }
                }
            }
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            for (float i = this.bottomLeft.x; i < this.topRight.x + 64.0f + 64.0f; i += 16.0f) {
                for (float j = this.bottomLeft.y; j < this.topRight.y + 64.0f + 64.0f + 64.0f; j += 16.0f) {
                    Tile temp = this.tilesToAdd.get(new Vector2(i, j));
                    if (temp != null && temp.name == "solid") {
                        boolean noTileYet = true;
                        Tile temp2 = this.tilesToAdd.get(new Vector2(i + 16.0f, j));
                        Tile temp3 = this.tilesToAdd.get(new Vector2(i, j + 16.0f));
                        Tile temp4 = this.tilesToAdd.get(new Vector2(i + 16.0f, j + 16.0f));
                        if (Math.abs(temp.position.x - this.bottomLeft.x) % 32.0f == 0.0f && Math.abs(temp.position.y - this.bottomLeft.y) % 32.0f == 0.0f && temp2 != null && temp3 != null && temp4 != null && temp2.name == "solid" && temp3.name == "solid" && temp4.name == "solid") {
                            this.tilesToAdd.put(temp.position.cpy().add(0.0f, 0.0f), new Tile("tree_large1", temp.position.cpy().add(0.0f, 0.0f), this.color));
                            this.tilesToAdd.put(temp.position.cpy().add(16.0f, 0.0f), new Tile("tree_large1_noSprite", temp.position.cpy().add(16.0f, 0.0f)));
                            this.tilesToAdd.put(temp.position.cpy().add(0.0f, 16.0f), new Tile("tree_large1_noSprite", temp.position.cpy().add(0.0f, 16.0f)));
                            this.tilesToAdd.put(temp.position.cpy().add(16.0f, 16.0f), new Tile("tree_large1_noSprite", temp.position.cpy().add(16.0f, 16.0f)));
                            noTileYet = false;
                        }
                        if (noTileYet) {
                            Route tempRoute = new Route("", 11);
                            String[] pokemon = {"pineco", "aipom", "kakuna", "metapod", "spinarak", "heracross", "ledyba", "hoothoot", "zubat", "pidgey", "spearow", "forretress", "applin"};
                            if (this.rand.nextInt(3) == 2) {
                                tempRoute.storedPokemon.add(new Pokemon(pokemon[this.rand.nextInt(pokemon.length)], 10 + this.rand.nextInt(4)));
                            }
                            this.tilesToAdd.put(temp.position.cpy().add(0.0f, 0.0f), new Tile("bush1", temp.position.cpy().add(0.0f, 0.0f), this.color, tempRoute));
                        }
                    }
                }
            }
        }
    }
}
